﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace MainThreadMoudle
{
    public class MainThread : MonoBehaviour
    {
        public ThreadList ThreadList { protected set; get; }

        private void Awake()
        {
            var factory = gameObject.GetComponent<ThreadListFactoryBase>();

            if(!factory)
            {
                Debug.LogError("没有从对象上找到游戏进程生产类！");
                gameObject.SetActive(false);
                return;
            }

            ThreadList = factory.CreateList();
            Debug.Log("Root method is active!");
        }


        public void PauseGameThread()
        {
            ThreadList.PauseList();
        }

        public void PlayGameThread()
        {
            ThreadList.PlayList();
        }



        // Start is called before the first frame update
        void Start()
        {
            ThreadList.Start();
        }

        // Update is called once per frame
        void Update()
        {
            ThreadList.Update();
        }
    }
}